package com.itfenghuang.day06;

import java.sql.*;

public class A05_atm {

    //传入查询sql 返回查询结果
    public static ResultSet select(String sql) throws SQLException, ClassNotFoundException {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/atm",
                "root", "123456");
        Statement stat = con.createStatement();

        ResultSet result = stat.executeQuery(sql);
        return result;
    }
    //传入查询sql 返回增删改
    public static int update(String sql) throws SQLException, ClassNotFoundException {
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/atm",
                "root", "123456");
        Statement stat = con.createStatement();

        int i = stat.executeUpdate(sql);
        return i;
    }









}
